<!-- 二级分类页面 -->
<template>
  <div class="childrenCate">
    <div class="w">
      <h3>全部分类</h3>
      <ul class="content">
        <router-link
          tag="li"
          v-for="item in cateList.children"
          :key="item.id"
          :to="'/threeCate?id=' + item.id"
        >
          <img :src="item.picture" alt="" />
          <p>{{ item.name }}</p>
        </router-link>
      </ul>
    </div>
    <!-- 分类商品 -->
    <div class="CateList" v-for="item in cateList.children" :key="item.id">
      <h3>{{ item.name }}</h3>
      <p>温暖柔软, 品质之选</p>
      <span>查看全部></span>
      <ul class="ul">
        <RouterLink
          to=""
          class="goods-item"
          v-for="it in item.goods"
          :key="it.id"
        >
          <img :src="it.picture" alt="" />
          <p>{{ it.name }}</p>
          <p>{{ it.desc }}</p>
          <p>&yen;{{ it.price }}</p>
        </RouterLink>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  // 接收分类数据
  props: ["nowId", "cateList"],
  data() {
    return {};
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/css/hoverShadow.scss";
.childrenCate {
  width: 100%;
  .w {
    height: 260px;
    margin-top: 20px;
    background-color: white;
    h3 {
      height: 100px;
      font-size: 28px;
      color: #666;
      font-weight: 400;
      text-align: center;
      line-height: 100px;
    }
    .content {
      width: 100%;
      height: 160px;
      padding: 0 32px;
      display: flex;
      li {
        width: 180px;
        height: 100%;
        img {
          width: 100px;
          height: 100px;
          display: block;
          margin: auto;
        }
        p {
          width: 100%;
          height: 40px;
          line-height: 40px;
          text-align: center;
        }
      }
      li:hover {
        color: #27ba9b;
        cursor: pointer;
      }
    }
  }
}
.CateList {
  width: 1240px;
  margin: auto;
  height: 458px;
  position: relative;
  background-color: white;
  margin-top: 20px;
  padding: 0 65px 30px;

  h3 {
    font-size: 28px;
    color: #666;
    font-weight: 400;
    text-align: center;
    line-height: 100px;
  }
  p {
    text-align: center;
    color: #999;
    font-size: 20px;
    position: relative;
    top: -20px;
  }
  span {
    font-size: 16px;
    vertical-align: middle;
    margin-right: 4px;
    color: #999;
    position: absolute;
    top: 30px;
    right: 0;
    &:hover {
      cursor: pointer;
      color: #27ba9b;
    }
  }
}
.ul {
  width: 100%;
  height: 428px;
  display: flex;
  justify-content: space-between;
}
.goods-item {
  display: block;
  width: 220px;
  height: 300px;
  padding: 20px 30px;
  text-align: center;
  @include hoverShadow;
  img {
    width: 160px;
    height: 160px;
  }
  p {
    &:nth-child(2) {
      margin-top: 25px;
      width: 160px;
      font-size: 16px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: black;
    }
    &:nth-child(3) {
      margin-top: 5px;
      width: 160px;
      font-size: 16px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: #999;
      height: 29px;
    }
    &:nth-child(4) {
      margin-top: 5px;
      width: 160px;
      color: #cf4444;
      font-size: 20px;
    }
  }
}
</style>
